{include file="public/nheader"}
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input name="title" class="layui-input" type="text" placeholder="昵称|手机号" />
                        </div>
                    </div>

                    <div class="layui-inline">
                        <!-- // 默认搜索 -->
                        <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>搜索</button>
                    </div>
                </div>
            </div>
        </div>

        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>

<script type="text/html" id="datagrid-toolbar">
</script>

<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    <!-- <a class="layui-table-text" lay-open data-title="赠送优惠券" data-area="80%,90%" data-url="/user/sendcoupon?user_id={{d.id}}" >赠送优惠券</a> -->
    <!-- <div class="layui-divider layui-divider-vertical"></div> -->
    <a class="layui-table-text" lay-open data-title="管理优惠券" data-area="80%,90%" data-url="/user/coupon?user_id={{d.id}}" >管理优惠券</a>

</script>


{include file="public/nfooter"}
<script>
    layui.use(['table'], function () {
        var table = layui.table;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            , url: "{:url()}"
            , page: true
            , size: 'lg'
            , even: true
            , cols: [[
                { type: 'checkbox', width: 60 },
                { field: 'id', align: 'center', sort: true, width: 80, title: 'ID' },
                { field: 'nickName', width: 250, align: 'center', title: '昵称' },
                {
                    field: 'sex', align: 'center', width: 100, templet: function (d) {
                        if (d.sex == 1) {
                            return '男';
                        }
                        if (d.sex == 1) {
                            return '女';
                        }
                        return '未知';
                    }, title: '性别'
                },
                {
                    field: 'money', align: 'center', width: 200, templet: function (d) {
                        return '<a style="color:blue" class="layui-table-text" lay-open data-title="积分明细" data-area="60%,80%" data-url="/user/interlog?id=' + d.id + '" >' + d.integral + '(累计:' + d.integralall + ')</a>';
                    }, title: '积分明细'
                },
                {
                    field: 'address', width: 200, align: 'center', templet: function (d) {
                        if (d.address == false) {
                            return '无';
                        }
                        return d.address.name + d.address.mobile + d.address.province_name + d.address.city_name + d.address.area_name + d.address.street_name;
                    }, title: '地址信息'
                },
                {
                    field: 'avatarUrl', align: 'center', width: 80, templet: function (d) {
                        return d.avatarUrl ? '<div><img src="' + d.avatarUrl + '"height="32" lay-image-click="" lay-size="100,100" ></div>' : '<div></div>';
                    }, title: '头像'
                },
                {
                    field: 'mobile', width: 200, align: 'center', title: '手机号', templet: function (d) {
                        if (d.mobile == null || d.mobile == '' || d.mobile == 'undefined') {
                            return '未授权';
                        }
                        return d.mobile;
                    }
                },
                { field: 'created', width: 200, align: 'center', title: '创建时间' },
                { align: 'center', toolbar: '#tableBar', width: 250, title: '操作' },
            ]]
        })
    })
</script>